package com.dataex.dbtool;

import org.slf4j.Logger;

public class ImpCommUtil {

	public static void SleepMs(int ms, Logger log ){
		
		try {
			if ( log != null )
				log.info("sleep ms:{} ms, please wait.................", ms);
			Thread.sleep(ms*1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
	
	/**
	 * 
	 * @param key
	 * @param jedisNum
	 * @return
	 */
	public static int getModIndex(String key, int serverNum){
		int num = key.hashCode();
		if (num == Integer.MIN_VALUE) {
			num = 0;
		}
		int tmpHashCode = Math.abs(num);
		int result = tmpHashCode % serverNum;
		return result;
	}
	
}
